package com.t26.web.controller;


import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.t26.web.dto.resp.CategoryRespDto;
import com.t26.web.entity.App_category;
import com.t26.web.service.App_categoryService;
import com.t26.web.vo.ResultData;
import com.t26.web.vo.ResultDataGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import java.util.List;

/**
 *
 * @author Whenlean
 * @since 2021-06-12
 */

@RestController
@RequestMapping("/app_category")
public class App_categoryController extends BaseController{

    @Autowired
    App_categoryService app_categoryService;

    /**
     * 查询一级分类
     * @mengyy
     */
    @GetMapping("/GetCategory")
    public ResultData<List<App_category>> getCategory(@RequestParam Long parentId){

        QueryWrapper<App_category> wrapper = new QueryWrapper<>();
        wrapper.eq("parentId",parentId);
        List<App_category> list1 = app_categoryService.list(wrapper);

        return ResultDataGenerator.genSuccessResult(list1,parentId+"分类");
    }

}

